#include<vector>
using namespace std;
class Solution {
public:
    int maxSales(vector<int>& sales) {
        int n = sales.size();
        vector<int> dp(n);
        dp[0] = sales[0];
        if (n == 1)return dp[0];
        for (int i = 1; i < n; i++)
            dp[i] = dp[i - 1] > 0 ? dp[i - 1] + sales[i] : sales[i];
        return *max_element(dp.begin(), dp.end());
    }
};